package org.ipb.controller.modul.strukturorganisasi;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.ipb.model.StrukturOrganisasi;

import util.hibernate.DAO;

import com.opensymphony.xwork2.ActionSupport;

public class ActionJsonMap extends ActionSupport {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Map<Integer, String> listStrukturOrganisasi = new HashMap<Integer, String>();

	// private List<Agama> list;
	@SuppressWarnings("unchecked")
	public String execute() {
		DAO<Integer> dao = new DAO<Integer>();
		dao.createCriteria(StrukturOrganisasi.class);
		// dao.createAliasLeftJoin("aksesKelompokMenu", "akm");
		// dao.createAlias("StrukturOrganisasi", "kp");
		List<StrukturOrganisasi> listTable = (List<StrukturOrganisasi>) dao
				.find();
		listStrukturOrganisasi.put(0, "Level Teratas");
		for (StrukturOrganisasi f : listTable) {
			listStrukturOrganisasi.put(f.getId(), f.getNama());
		}
		dao.close();
		return SUCCESS;
	}

	public Map<Integer, String> getListStrukturOrganisasi() {
		return listStrukturOrganisasi;
	}

	public void setListStrukturOrganisasi(
			Map<Integer, String> listStrukturOrganisasi) {
		this.listStrukturOrganisasi = listStrukturOrganisasi;
	}

}
